/**
 * Created by trump on 15/11/30.
 */
import React from 'react';
import { Router, Route, Link, IndexRoute } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import createHashHistory from 'history/lib/createHashHistory';

let applicationHistory = createBrowserHistory();

var routes = {
    component: require('./application.jsx'),
    childRoutes: [
        {
            path: '/',
            getComponent(location, cb) {
                require.ensure([], (require) => cb(null, require('./pages/index.jsx')))
            }
        },
        {
            path: '/login',
            getComponent(location, cb) {
                require.ensure([], (require) => cb(null, require('./pages/login.jsx')))
            }
        },
        {
            path: '*',
            getComponent(location, cb) {
                require.ensure([], (require) => cb(null, require('./pages/notFound.jsx')))
            }
        }
    ]

};

export default <Router history={applicationHistory} routes={routes}/>;